<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<link rel="stylesheet" type="text/css" href="stylesheets/style.css">
<title>{E}Properties Examples</title>
</head>

<body>
<h1>Examples</h1>

<p>This page contains a list of examples using EProperties to solve common
software development problems.  Perhaps the best way to learn to use
EProeprties is to look at the examples, and combine the examples into 
your own properties files.</p>

<p>You should view the examples below as a 'cookbook' - you can use and
combine these examples into many clever combinations.</p>

<p>This is a work in progress!!</p>

<ul>
  <li>General Examples
    <ul>
      <li>Hello World</li>
      <li>I18N</li>
      <li>SQL with substitutions</li>
    </ul>
  </li>
  <li>Server side
    <ul>
      <li>Environment specific configuration</li>
      <li>Local properties override (inclusion w/ params)</li>
    </ul></li>
  <li>Client side
    <ul>
      <li>Preferences</li>
      <li>Saving state</li>
      <li>Listener / update (menu structures)</li>
    </ul></li>
</ul>

Include and I18N example

<pre>
languages={
   english={
      hello=Hello
      world=World
   }
   spanish={
      hello=Hola
      world=Mundo
   }
}
# This loads the system properties into the current context.
system=[method://java.lang.System.getProperties()]

# This is a complex substitution, with a default value of 'spanish'
lang=${system->lang|spanish}

current.lang=${languages->${lang}}

hello.world="${current.lang->hello} ${current.lang->world}"
</pre>

<p>The output from a listing of this file is:</p>
<div class="output">

---- listing ----
languages= {
  english= {
    hello=Hello
    world=World
  }
  spanish= {
    hello=Hola
    world=Mundo
  }
}
# system properties omitted from listing
lang=spanish
current.lang= {
  hello=Hola
  world=Mundo
}
hello.world=Hola Mundo
</div>

</body>
</html>

